package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.TMonthlySaleRptModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by hyp on 2016/12/7.
 */
public interface TMonthlySaleRptRepository extends JpaRepository<TMonthlySaleRptModel, Integer>, JpaSpecificationExecutor<TMonthlySaleRptModel> {

    @Query("select a from TMonthlySaleRptModel a where a.permit=?1 and a.statYear=?2 and a.statMonth=?3 and a.model=?4")
    TMonthlySaleRptModel findByPermitAndYearAndMonthAndBrand(String permit, Integer year, String month, String brand);


    @Query("select a from TMonthlySaleRptModel a where a.permit=?1 and a.statYear=?2")
    List<TMonthlySaleRptModel> findReportByPermitAndYear(String permit, Integer year);

}
